Open In Colab

In [340]:
!pip install pyreadstat
!pip install pandas-profiling==2.7.1

!wget -q "https://github.com/casalazara/Data-Science-Aplicado/blob/master/Lab2/B.sav?raw=true" -O "B.sav"
!wget -q "https://github.com/casalazara/Data-Science-Aplicado/blob/master/Lab2/D.sav?raw=true" -O "D.sav"
!wget -q "https://github.com/casalazara/Data-Science-Aplicado/blob/master/Lab2/H.sav?raw=true" -O "H.sav"
Requirement already satisfied: pyreadstat in /usr/local/lib/python3.6/dist-packages (1.0.2)
Requirement already satisfied: pandas>0.24.0 in /usr/local/lib/python3.6/dist-packages (from pyreadstat) (1.0.5)
Requirement already satisfied: pytz>=2017.2 in /usr/local/lib/python3.6/dist-packages (from pandas>0.24.0->pyreadstat) (2018.9)
Requirement already satisfied: python-dateutil>=2.6.1 in /usr/local/lib/python3.6/dist-packages (from pandas>0.24.0->pyreadstat) (2.8.1)
Requirement already satisfied: numpy>=1.13.3 in /usr/local/lib/python3.6/dist-packages (from pandas>0.24.0->pyreadstat) (1.18.5)
Requirement already satisfied: six>=1.5 in /usr/local/lib/python3.6/dist-packages (from python-dateutil>=2.6.1->pandas>0.24.0->pyreadstat) (1.15.0)
Requirement already satisfied: pandas-profiling==2.7.1 in /usr/local/lib/python3.6/dist-packages (2.7.1)
Requirement already satisfied: scipy>=1.4.1 in /usr/local/lib/python3.6/dist-packages (from pandas-profiling==2.7.1) (1.4.1)
Requirement already satisfied: jinja2>=2.11.1 in /usr/local/lib/python3.6/dist-packages (from pandas-profiling==2.7.1) (2.11.2)
Requirement already satisfied: ipywidgets>=7.5.1 in /usr/local/lib/python3.6/dist-packages (from pandas-profiling==2.7.1) (7.5.1)
Requirement already satisfied: phik>=0.9.10 in /usr/local/lib/python3.6/dist-packages (from pandas-profiling==2.7.1) (0.10.0)
Requirement already satisfied: matplotlib>=3.2.0 in /usr/local/lib/python3.6/dist-packages (from pandas-profiling==2.7.1) (3.2.2)
Requirement already satisfied: requests>=2.23.0 in /usr/local/lib/python3.6/dist-packages (from pandas-profiling==2.7.1) (2.23.0)
Requirement already satisfied: visions[type_image_path]==0.4.1 in /usr/local/lib/python3.6/dist-packages (from pandas-profiling==2.7.1) (0.4.1)
Requirement already satisfied: tangled-up-in-unicode>=0.0.4 in /usr/local/lib/python3.6/dist-packages (from pandas-profiling==2.7.1) (0.0.6)
Requirement already satisfied: tqdm>=4.43.0 in /usr/local/lib/python3.6/dist-packages (from pandas-profiling==2.7.1) (4.48.2)
Requirement already satisfied: missingno>=0.4.2 in /usr/local/lib/python3.6/dist-packages (from pandas-profiling==2.7.1) (0.4.2)
Requirement already satisfied: joblib in /usr/local/lib/python3.6/dist-packages (from pandas-profiling==2.7.1) (0.16.0)
Requirement already satisfied: numpy>=1.16.0 in /usr/local/lib/python3.6/dist-packages (from pandas-profiling==2.7.1) (1.18.5)
Requirement already satisfied: htmlmin>=0.1.12 in /usr/local/lib/python3.6/dist-packages (from pandas-profiling==2.7.1) (0.1.12)
Requirement already satisfied: pandas!=1.0.0,!=1.0.1,!=1.0.2,>=0.25.3 in /usr/local/lib/python3.6/dist-packages (from pandas-profiling==2.7.1) (1.0.5)
Requirement already satisfied: astropy>=4.0 in /usr/local/lib/python3.6/dist-packages (from pandas-profiling==2.7.1) (4.0.1.post1)
Requirement already satisfied: confuse>=1.0.0 in /usr/local/lib/python3.6/dist-packages (from pandas-profiling==2.7.1) (1.3.0)
Requirement already satisfied: MarkupSafe>=0.23 in /usr/local/lib/python3.6/dist-packages (from jinja2>=2.11.1->pandas-profiling==2.7.1) (1.1.1)
Requirement already satisfied: ipykernel>=4.5.1 in /usr/local/lib/python3.6/dist-packages (from ipywidgets>=7.5.1->pandas-profiling==2.7.1) (4.10.1)
Requirement already satisfied: ipython>=4.0.0; python_version >= "3.3" in /usr/local/lib/python3.6/dist-packages (from ipywidgets>=7.5.1->pandas-profiling==2.7.1) (5.5.0)
Requirement already satisfied: nbformat>=4.2.0 in /usr/local/lib/python3.6/dist-packages (from ipywidgets>=7.5.1->pandas-profiling==2.7.1) (5.0.7)
Requirement already satisfied: widgetsnbextension~=3.5.0 in /usr/local/lib/python3.6/dist-packages (from ipywidgets>=7.5.1->pandas-profiling==2.7.1) (3.5.1)
Requirement already satisfied: traitlets>=4.3.1 in /usr/local/lib/python3.6/dist-packages (from ipywidgets>=7.5.1->pandas-profiling==2.7.1) (4.3.3)
Requirement already satisfied: numba>=0.38.1 in /usr/local/lib/python3.6/dist-packages (from phik>=0.9.10->pandas-profiling==2.7.1) (0.48.0)
Requirement already satisfied: kiwisolver>=1.0.1 in /usr/local/lib/python3.6/dist-packages (from matplotlib>=3.2.0->pandas-profiling==2.7.1) (1.2.0)
Requirement already satisfied: cycler>=0.10 in /usr/local/lib/python3.6/dist-packages (from matplotlib>=3.2.0->pandas-profiling==2.7.1) (0.10.0)
Requirement already satisfied: python-dateutil>=2.1 in /usr/local/lib/python3.6/dist-packages (from matplotlib>=3.2.0->pandas-profiling==2.7.1) (2.8.1)
Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 in /usr/local/lib/python3.6/dist-packages (from matplotlib>=3.2.0->pandas-profiling==2.7.1) (2.4.7)
Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.6/dist-packages (from requests>=2.23.0->pandas-profiling==2.7.1) (2020.6.20)
Requirement already satisfied: idna<3,>=2.5 in /usr/local/lib/python3.6/dist-packages (from requests>=2.23.0->pandas-profiling==2.7.1) (2.10)
Requirement already satisfied: chardet<4,>=3.0.2 in /usr/local/lib/python3.6/dist-packages (from requests>=2.23.0->pandas-profiling==2.7.1) (3.0.4)
Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in /usr/local/lib/python3.6/dist-packages (from requests>=2.23.0->pandas-profiling==2.7.1) (1.24.3)
Requirement already satisfied: attrs>=19.3.0 in /usr/local/lib/python3.6/dist-packages (from visions[type_image_path]==0.4.1->pandas-profiling==2.7.1) (20.1.0)
Requirement already satisfied: networkx>=2.4 in /usr/local/lib/python3.6/dist-packages (from visions[type_image_path]==0.4.1->pandas-profiling==2.7.1) (2.5)
Requirement already satisfied: imagehash; extra == "type_image_path" in /usr/local/lib/python3.6/dist-packages (from visions[type_image_path]==0.4.1->pandas-profiling==2.7.1) (4.1.0)
Requirement already satisfied: Pillow; extra == "type_image_path" in /usr/local/lib/python3.6/dist-packages (from visions[type_image_path]==0.4.1->pandas-profiling==2.7.1) (7.0.0)
Requirement already satisfied: seaborn in /usr/local/lib/python3.6/dist-packages (from missingno>=0.4.2->pandas-profiling==2.7.1) (0.10.1)
Requirement already satisfied: pytz>=2017.2 in /usr/local/lib/python3.6/dist-packages (from pandas!=1.0.0,!=1.0.1,!=1.0.2,>=0.25.3->pandas-profiling==2.7.1) (2018.9)
Requirement already satisfied: pyyaml in /usr/local/lib/python3.6/dist-packages (from confuse>=1.0.0->pandas-profiling==2.7.1) (3.13)
Requirement already satisfied: jupyter-client in /usr/local/lib/python3.6/dist-packages (from ipykernel>=4.5.1->ipywidgets>=7.5.1->pandas-profiling==2.7.1) (5.3.5)
Requirement already satisfied: tornado>=4.0 in /usr/local/lib/python3.6/dist-packages (from ipykernel>=4.5.1->ipywidgets>=7.5.1->pandas-profiling==2.7.1) (5.1.1)
Requirement already satisfied: decorator in /usr/local/lib/python3.6/dist-packages (from ipython>=4.0.0; python_version >= "3.3"->ipywidgets>=7.5.1->pandas-profiling==2.7.1) (4.4.2)
Requirement already satisfied: setuptools>=18.5 in /usr/local/lib/python3.6/dist-packages (from ipython>=4.0.0; python_version >= "3.3"->ipywidgets>=7.5.1->pandas-profiling==2.7.1) (49.6.0)
Requirement already satisfied: pexpect; sys_platform != "win32" in /usr/local/lib/python3.6/dist-packages (from ipython>=4.0.0; python_version >= "3.3"->ipywidgets>=7.5.1->pandas-profiling==2.7.1) (4.8.0)
Requirement already satisfied: prompt-toolkit<2.0.0,>=1.0.4 in /usr/local/lib/python3.6/dist-packages (from ipython>=4.0.0; python_version >= "3.3"->ipywidgets>=7.5.1->pandas-profiling==2.7.1) (1.0.18)
Requirement already satisfied: pickleshare in /usr/local/lib/python3.6/dist-packages (from ipython>=4.0.0; python_version >= "3.3"->ipywidgets>=7.5.1->pandas-profiling==2.7.1) (0.7.5)
Requirement already satisfied: simplegeneric>0.8 in /usr/local/lib/python3.6/dist-packages (from ipython>=4.0.0; python_version >= "3.3"->ipywidgets>=7.5.1->pandas-profiling==2.7.1) (0.8.1)
Requirement already satisfied: pygments in /usr/local/lib/python3.6/dist-packages (from ipython>=4.0.0; python_version >= "3.3"->ipywidgets>=7.5.1->pandas-profiling==2.7.1) (2.1.3)
Requirement already satisfied: jupyter-core in /usr/local/lib/python3.6/dist-packages (from nbformat>=4.2.0->ipywidgets>=7.5.1->pandas-profiling==2.7.1) (4.6.3)
Requirement already satisfied: jsonschema!=2.5.0,>=2.4 in /usr/local/lib/python3.6/dist-packages (from nbformat>=4.2.0->ipywidgets>=7.5.1->pandas-profiling==2.7.1) (2.6.0)
Requirement already satisfied: ipython-genutils in /usr/local/lib/python3.6/dist-packages (from nbformat>=4.2.0->ipywidgets>=7.5.1->pandas-profiling==2.7.1) (0.2.0)
Requirement already satisfied: notebook>=4.4.1 in /usr/local/lib/python3.6/dist-packages (from widgetsnbextension~=3.5.0->ipywidgets>=7.5.1->pandas-profiling==2.7.1) (5.3.1)
Requirement already satisfied: six in /usr/local/lib/python3.6/dist-packages (from traitlets>=4.3.1->ipywidgets>=7.5.1->pandas-profiling==2.7.1) (1.15.0)
Requirement already satisfied: llvmlite<0.32.0,>=0.31.0dev0 in /usr/local/lib/python3.6/dist-packages (from numba>=0.38.1->phik>=0.9.10->pandas-profiling==2.7.1) (0.31.0)
Requirement already satisfied: PyWavelets in /usr/local/lib/python3.6/dist-packages (from imagehash; extra == "type_image_path"->visions[type_image_path]==0.4.1->pandas-profiling==2.7.1) (1.1.1)
Requirement already satisfied: pyzmq>=13 in /usr/local/lib/python3.6/dist-packages (from jupyter-client->ipykernel>=4.5.1->ipywidgets>=7.5.1->pandas-profiling==2.7.1) (19.0.2)
Requirement already satisfied: ptyprocess>=0.5 in /usr/local/lib/python3.6/dist-packages (from pexpect; sys_platform != "win32"->ipython>=4.0.0; python_version >= "3.3"->ipywidgets>=7.5.1->pandas-profiling==2.7.1) (0.6.0)
Requirement already satisfied: wcwidth in /usr/local/lib/python3.6/dist-packages (from prompt-toolkit<2.0.0,>=1.0.4->ipython>=4.0.0; python_version >= "3.3"->ipywidgets>=7.5.1->pandas-profiling==2.7.1) (0.2.5)
Requirement already satisfied: terminado>=0.8.1 in /usr/local/lib/python3.6/dist-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets>=7.5.1->pandas-profiling==2.7.1) (0.8.3)
Requirement already satisfied: nbconvert in /usr/local/lib/python3.6/dist-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets>=7.5.1->pandas-profiling==2.7.1) (5.6.1)
Requirement already satisfied: Send2Trash in /usr/local/lib/python3.6/dist-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets>=7.5.1->pandas-profiling==2.7.1) (1.5.0)
Requirement already satisfied: pandocfilters>=1.4.1 in /usr/local/lib/python3.6/dist-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets>=7.5.1->pandas-profiling==2.7.1) (1.4.2)
Requirement already satisfied: bleach in /usr/local/lib/python3.6/dist-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets>=7.5.1->pandas-profiling==2.7.1) (3.1.5)
Requirement already satisfied: mistune<2,>=0.8.1 in /usr/local/lib/python3.6/dist-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets>=7.5.1->pandas-profiling==2.7.1) (0.8.4)
Requirement already satisfied: entrypoints>=0.2.2 in /usr/local/lib/python3.6/dist-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets>=7.5.1->pandas-profiling==2.7.1) (0.3)
Requirement already satisfied: defusedxml in /usr/local/lib/python3.6/dist-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets>=7.5.1->pandas-profiling==2.7.1) (0.6.0)
Requirement already satisfied: testpath in /usr/local/lib/python3.6/dist-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets>=7.5.1->pandas-profiling==2.7.1) (0.4.4)
Requirement already satisfied: webencodings in /usr/local/lib/python3.6/dist-packages (from bleach->nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets>=7.5.1->pandas-profiling==2.7.1) (0.5.1)
Requirement already satisfied: packaging in /usr/local/lib/python3.6/dist-packages (from bleach->nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets>=7.5.1->pandas-profiling==2.7.1) (20.4)
In [341]:
# Importante librerias o modulos que se van a usar en esta sesion
import os, sys
import numpy as np
import pandas as pd
import pandas_profiling 

##Librerías para graficar
import matplotlib
matplotlib.style.use('ggplot')
from matplotlib import pyplot as plt

Lectura de los datos

In [342]:
condiVida = pd.read_spss('B.sav')
fuerTrabajo = pd.read_spss('H.sav')
In [343]:
condiVida.head()
Out[343]:
DIRECTORIO FEX_C REGION DIA_REFERENCIA_2 clase P424 P4030S1 P4030S1A1 P4030S5 P4030S3 P4030S4 P4030S4A1 P4030S2 P4020
0 2915591.0 463.993402 Central Domingo Cabecera Casa 3.0 3.0 Cemento, gravilla
1 2915592.0 93.084381 Pacífica Miércoles Cabecera Casa 1.0 No No 3.0 No Baldosa, cerámica, laminado
2 2915593.0 516.279638 Central Domingo Cabecera Casa 1.0 3.0 Baldosa, cerámica, laminado
3 2915594.0 655.671443 Central Domingo Cabecera Apartamento 1.0 3.0 Cemento, gravilla
4 2915595.0 326.783507 Central Lunes Cabecera Apartamento 1.0 3.0 Baldosa, cerámica, laminado
In [344]:
fuerTrabajo.head()
Out[344]:
DIRECTORIO SECUENCIA_P ORDEN P6370S1 P6390S1 P6880 P6440 P6400 P1151 P1150 P1150S1 P1150S2 P1099 P1099S1 P1099S2 P1098 P427 P6500 P6750 P6760 P6426 P428 P6250 P6850 P1149 P1149S1 P1149S2 P1148S1 P1148S2 P7070 P6510 P6510S1 P6545 P6545S1 P1145 P1145S1 P1145S2
0 2915591.0 1.0 1.0 53 5529 En esta vivienda No. NaN 4.0 4.0 0.0 NaN 0.0 0.0 NaN Trabajador por cuenta propia NaN 90000.0 1.0 12.0 Trabaja solo No NaN NaN NaN NaN NaN NaN NaN No NaN No. NaN No. NaN NaN
1 2915592.0 1.0 1.0 62 113 En el campo o área rural, mar o río No. NaN 12.0 No. NaN NaN NaN NaN NaN Realizar labores del hogar. Trabajador de su propia finca o de finca en ar... NaN 300000.0 1.0 96.0 2 a 4 personas No NaN NaN NaN NaN NaN NaN NaN 8300000.0 No. NaN No. NaN NaN
2 2915593.0 1.0 1.0 79 1810 En esta vivienda No. NaN 30.0 No. NaN NaN NaN NaN NaN Día festivo o fin de semana. Trabajador por cuenta propia NaN 200000.0 1.0 84.0 Trabaja solo No NaN NaN NaN NaN NaN NaN NaN 800000.0 No. NaN Dentro del país. 550000.0
3 2915593.0 1.0 2.0 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN No NaN No. NaN No. NaN NaN
4 2915594.0 1.0 1.0 85 5272 Local fijo, oficina, fábrica, etc. No. NaN 25.0 No. NaN NaN NaN NaN NaN Día festivo o fin de semana. Trabajador por cuenta propia NaN 200000.0 1.0 300.0 2 a 4 personas 28.0 5.0 0.0 0.0 0.0 400000.0 No NaN No. NaN No. NaN NaN

B. CONDICIONES DE LA VIVIENDA

Análisis del tipo de variables

In [345]:
condiVida.dtypes
Out[345]:
DIRECTORIO           float64
FEX_C                float64
REGION              category
DIA_REFERENCIA_2    category
clase               category
P424                category
P4030S1             category
P4030S1A1            float64
P4030S5             category
P4030S3             category
P4030S4             category
P4030S4A1            float64
P4030S2             category
P4020               category
dtype: object

De acuerdo a la descripción de variables en la página, las columnas P4030S1A1 y P4030S4A1 son las únicas variables numéricas discretas, las demás son continuas. Sin embargo, estas columnas cuentan con valores no numéricos que se deben reemplazar por lo que antes de cambiar el tipo hay que decidir qué hacer con ellos.

In [346]:
def cambiara_int(condiVida):
    condiVida["P4030S1A1"]=condiVida["P4030S1A1"].astype(int)
    condiVida["P4030S4A1"]=condiVida["P4030S4A1"].astype(int)

Datos duplicados

In [347]:
duplicados = condiVida.duplicated().sum()
print(duplicados)
condiVida[condiVida.duplicated()]
0
Out[347]:
DIRECTORIO FEX_C REGION DIA_REFERENCIA_2 clase P424 P4030S1 P4030S1A1 P4030S5 P4030S3 P4030S4 P4030S4A1 P4030S2 P4020

Datos faltantes

In [348]:
def missing_values_table(df): 
        mis_val = df.isnull().sum()
        mis_val_percent = 100 * df.isnull().sum()/len(df)
        mis_val_table = pd.concat([mis_val, mis_val_percent], axis=1)
        mis_val_table_ren_columns = mis_val_table.rename(
        columns = {0 : 'Missing Values', 1 : '% of Total Values'})
        return mis_val_table_ren_columns 
In [349]:
missing_values_table(condiVida)
Out[349]:
Missing Values % of Total Values
DIRECTORIO 0 0.000000
FEX_C 0 0.000000
REGION 0 0.000000
DIA_REFERENCIA_2 0 0.000000
clase 0 0.000000
P424 0 0.000000
P4030S1 0 0.000000
P4030S1A1 872 2.062197
P4030S5 0 0.000000
P4030S3 0 0.000000
P4030S4 0 0.000000
P4030S4A1 7267 17.185763
P4030S2 0 0.000000
P4020 0 0.000000

La mayoría de columnas no tienen valores nulos. Sin embargo, las columnas P4030S1A1 y P4030S4A1 cuentan con valores nulos, la columna P4030S4A1 corresponde de acuerdo al diccionario a el número de días por semana que se realiza la recolección de basuras

In [350]:
(condiVida['P4030S4A1'].value_counts()*100/len(condiVida)).plot(kind='bar')
Out[350]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fa36d7a70f0>

Mientras que la columna P4030S1A1 corresponde al estrato para la tarifa de la energía eléctrica

In [351]:
(condiVida['P4030S1A1'].value_counts()*100/len(condiVida)).plot(kind='bar')
Out[351]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fa3772d4160>

Para la columna P4030S1A1 dada la baja cantidad de filas con este valor nulo y la importancia del estrato socioeconómico para los análisis lo mejor es eliminar estas filas, para la columna P4030S4A1 dada la distribución de valores lo mejor sería reemplazar los valores faltantes con la moda (3.0)

In [352]:
condiVida.dropna(axis=0, subset=['P4030S1A1'],inplace=True)
condiVida['P4030S4A1'] = condiVida['P4030S4A1'].fillna(condiVida['P4030S4A1'].mode()[0])
missing_values_table(condiVida)
Out[352]:
Missing Values % of Total Values
DIRECTORIO 0 0.0
FEX_C 0 0.0
REGION 0 0.0
DIA_REFERENCIA_2 0 0.0
clase 0 0.0
P424 0 0.0
P4030S1 0 0.0
P4030S1A1 0 0.0
P4030S5 0 0.0
P4030S3 0 0.0
P4030S4 0 0.0
P4030S4A1 0 0.0
P4030S2 0 0.0
P4020 0 0.0
In [353]:
cambiara_int(condiVida)
condiVida.head()
Out[353]:
DIRECTORIO FEX_C REGION DIA_REFERENCIA_2 clase P424 P4030S1 P4030S1A1 P4030S5 P4030S3 P4030S4 P4030S4A1 P4030S2 P4020
0 2915591.0 463.993402 Central Domingo Cabecera Casa 3 3 Cemento, gravilla
1 2915592.0 93.084381 Pacífica Miércoles Cabecera Casa 1 No No 3 No Baldosa, cerámica, laminado
2 2915593.0 516.279638 Central Domingo Cabecera Casa 1 3 Baldosa, cerámica, laminado
3 2915594.0 655.671443 Central Domingo Cabecera Apartamento 1 3 Cemento, gravilla
4 2915595.0 326.783507 Central Lunes Cabecera Apartamento 1 3 Baldosa, cerámica, laminado

Análisis valores de las variables

Si una variable contiene valores no lógicos lo primero que haría sobre la base de datos sería mirar los datos de las filas con estos valores de manera que se pueda identificar si el error fue intencionado o no, si no lo fue tratar de mirar una forma de corregirlo de acuerdo al valor allí presente, en caso de no poderse dependría de la importancia de la variable para los análisis el desechar la fila o no.

In [354]:
col_interes = 'DIRECTORIO	REGION	clase	P424	P4030S1	P4030S1A1	P4030S5	P4030S3	P4030S4	P4030S4A1	P4030S2	P4020'.split("\t")
condiVida = condiVida[col_interes]
for columna in condiVida.columns:
  print(columna,"\n",condiVida[columna].unique())
DIRECTORIO 
 [2915591. 2915592. 2915593. ... 2965178. 2965179. 2965180.]
REGION 
 [Central, Pacífica, Oriental, Atlántica, San Andrés, Bogotá]
Categories (6, object): [Central, Pacífica, Oriental, Atlántica, San Andrés, Bogotá]
clase 
 [Cabecera, Resto]
Categories (2, object): [Cabecera, Resto]
P424 
 [Casa, Apartamento, Cuarto(s), Vivienda indígena, Otra vivienda (carpa, tienda, vagón, refugio n...]
Categories (5, object): [Casa, Apartamento, Cuarto(s), Vivienda indígena,
                         Otra vivienda (carpa, tienda, vagón, refugio n...]
P4030S1 
 [Sí]
Categories (1, object): [Sí]
P4030S1A1 
 [3 1 2 4 0 5 9 6]
P4030S5 
 [Sí, No]
Categories (2, object): [Sí, No]
P4030S3 
 [Sí, No]
Categories (2, object): [Sí, No]
P4030S4 
 [Sí, No]
Categories (2, object): [Sí, No]
P4030S4A1 
 [3 2 6 1 7 5 4 8]
P4030S2 
 [Sí, No]
Categories (2, object): [Sí, No]
P4020 
 [Cemento, gravilla, Baldosa, cerámica, laminado, Vinilo, tableta, ladrillo, madera pulida sin l..., Tierra, arena, Mármol, parqué, madera pulida y lacada, Madera burda, tabla o tablón, otro vegetal, Alfombra o tapete de pared a pared]
Categories (7, object): [Cemento, gravilla, Baldosa, cerámica, laminado,
                         Vinilo, tableta, ladrillo, madera pulida sin l..., Tierra, arena, Mármol, parqué, madera pulida y lacada,
                         Madera burda, tabla o tablón, otro vegetal, Alfombra o tapete de pared a pared]

De acuerdo al diccionario todos los valores son válidos

H. FUERZA DE TRABAJO - Uso del tiempo e ingresos

Análisis del tipo de variables

In [355]:
fuerTrabajo.dtypes
Out[355]:
DIRECTORIO      float64
SECUENCIA_P     float64
ORDEN           float64
P6370S1          object
P6390S1          object
P6880          category
P6440          category
P6400          category
P1151           float64
P1150          category
P1150S1         float64
P1150S2         float64
P1099           float64
P1099S1         float64
P1099S2         float64
P1098          category
P427           category
P6500           float64
P6750           float64
P6760           float64
P6426           float64
P428           category
P6250          category
P6850           float64
P1149          category
P1149S1         float64
P1149S2         float64
P1148S1         float64
P1148S2         float64
P7070           float64
P6510          category
P6510S1         float64
P6545          category
P6545S1         float64
P1145          category
P1145S1        category
P1145S2         float64
dtype: object

Las columnas SECUENCIA_P, P1150S1, P1099S1, P6500, P1149S1 y P1148S1 de acuerdo a la información de las variables deberían ser discretas, las columnas P6370S1 y P6390S1 deberían ser continuas, las demás columnas están en el tipo que deberían estar. Sin embargo por la presencia de valores nulos en ellas no se puede hacer el cambio sin haberlos removido previamente

In [356]:
    def cambiar_int2(fuerTrabajo):
      #fuerTrabajo["P6350"]=fuerTrabajo["P6350"].astype(int) #Se remueve más adelante por la cantidad de ausencias
      fuerTrabajo["SECUENCIA_P"]=fuerTrabajo["SECUENCIA_P"].astype(int)
      fuerTrabajo['P6370S1'] = fuerTrabajo['P6370S1'].astype(float)
      fuerTrabajo['P6390S1'] = fuerTrabajo['P6390S1'].astype(float)
      fuerTrabajo['P1150S1'] = fuerTrabajo['P6390S1'].astype(float)
      fuerTrabajo['P1099S1'] = fuerTrabajo['P6390S1'].astype(float)
      fuerTrabajo['P6500'] = fuerTrabajo['P6390S1'].astype(float)
      fuerTrabajo['P1149S1'] = fuerTrabajo['P6390S1'].astype(float)
      fuerTrabajo['P1148S1'] = fuerTrabajo['P6390S1'].astype(float)            

Datos duplicados

In [357]:
duplicados = fuerTrabajo.duplicated().sum()
print(duplicados)
fuerTrabajo[fuerTrabajo.duplicated()]
0
Out[357]:
DIRECTORIO SECUENCIA_P ORDEN P6370S1 P6390S1 P6880 P6440 P6400 P1151 P1150 P1150S1 P1150S2 P1099 P1099S1 P1099S2 P1098 P427 P6500 P6750 P6760 P6426 P428 P6250 P6850 P1149 P1149S1 P1149S2 P1148S1 P1148S2 P7070 P6510 P6510S1 P6545 P6545S1 P1145 P1145S1 P1145S2

Datos faltantes

In [358]:
faltantes = missing_values_table(fuerTrabajo)
faltantes
Out[358]:
Missing Values % of Total Values
DIRECTORIO 0 0.000000
SECUENCIA_P 0 0.000000
ORDEN 0 0.000000
P6370S1 0 0.000000
P6390S1 0 0.000000
P6880 60174 48.796588
P6440 60174 48.796588
P6400 89633 72.685621
P1151 60174 48.796588
P1150 60174 48.796588
P1150S1 75872 61.526485
P1150S2 75872 61.526485
P1099 123316 100.000000
P1099S1 75872 61.526485
P1099S2 75872 61.526485
P1098 107618 87.270103
P427 60174 48.796588
P6500 89010 72.180415
P6750 96292 78.085569
P6760 96292 78.085569
P6426 60174 48.796588
P428 60174 48.796588
P6250 60174 48.796588
P6850 120294 97.549385
P1149 120294 97.549385
P1149S1 121863 98.821726
P1149S2 121863 98.821726
P1148S1 121863 98.821726
P1148S2 121863 98.821726
P7070 120294 97.549385
P6510 0 0.000000
P6510S1 115576 93.723442
P6545 0 0.000000
P6545S1 119085 96.568977
P1145 0 0.000000
P1145S1 108880 88.293490
P1145S2 108880 88.293490

Hay una gran cantidad de columnas con más del 80% de valores faltantes por lo que es mejor removerlas y ver con más detalle la importancia de las que siguen presentando valores nulos

In [359]:
a_remover=[]
for columna in fuerTrabajo.columns:
  if faltantes.loc[columna,'% of Total Values'] >= 80:
    a_remover.append(columna)
fuerTrabajo.drop(axis=1,columns=a_remover,inplace=True)
missing_values_table(fuerTrabajo)
Out[359]:
Missing Values % of Total Values
DIRECTORIO 0 0.000000
SECUENCIA_P 0 0.000000
ORDEN 0 0.000000
P6370S1 0 0.000000
P6390S1 0 0.000000
P6880 60174 48.796588
P6440 60174 48.796588
P6400 89633 72.685621
P1151 60174 48.796588
P1150 60174 48.796588
P1150S1 75872 61.526485
P1150S2 75872 61.526485
P1099S1 75872 61.526485
P1099S2 75872 61.526485
P427 60174 48.796588
P6500 89010 72.180415
P6750 96292 78.085569
P6760 96292 78.085569
P6426 60174 48.796588
P428 60174 48.796588
P6250 60174 48.796588
P6510 0 0.000000
P6545 0 0.000000
P1145 0 0.000000

Para las columnas con valores faltantes considero prudente eliminar las filas que no tengan mínimo 14 columnas llenas.

In [360]:
fuerTrabajo.dropna(subset=['P6880','P6440','P6400','P1151','P1150','P1150S1','P1150S2','P1099S1','P1099S2','P427','P6500','P6750','P6760','P6426','P428','P6250'],thresh=14,inplace=True)
missing_values_table(fuerTrabajo)
Out[360]:
Missing Values % of Total Values
DIRECTORIO 0 0.000000
SECUENCIA_P 0 0.000000
ORDEN 0 0.000000
P6370S1 0 0.000000
P6390S1 0 0.000000
P6880 0 0.000000
P6440 0 0.000000
P6400 17784 41.243999
P1151 0 0.000000
P1150 0 0.000000
P1150S1 0 0.000000
P1150S2 0 0.000000
P1099S1 0 0.000000
P1099S2 0 0.000000
P427 0 0.000000
P6500 20269 47.007120
P6750 22850 52.992880
P6760 22850 52.992880
P6426 0 0.000000
P428 0 0.000000
P6250 0 0.000000
P6510 0 0.000000
P6545 0 0.000000
P1145 0 0.000000
In [361]:
for columna in (['P6400','P6500','P6750','P6760']):
  print(fuerTrabajo[columna].value_counts())
Sí                      22835
No.                      2487
No sabe, no informa.       13
Name: P6400, dtype: int64
600000.0     2007
800000.0     1231
700000.0     1146
566700.0     1139
1200000.0     855
             ... 
346000.0        1
1777000.0       1
560700.0        1
756800.0        1
426000.0        1
Name: P6500, Length: 1040, dtype: int64
600000.0      1708
300000.0      1592
500000.0      1228
400000.0      1219
200000.0      1186
              ... 
315000.0         1
11200000.0       1
364000.0         1
519500.0         1
2240000.0        1
Name: P6750, Length: 437, dtype: int64
1.0     20132
2.0        49
3.0        24
12.0       14
6.0        12
4.0        10
5.0         8
24.0        7
10.0        2
20.0        2
9.0         2
18.0        2
8.0         2
7.0         1
17.0        1
22.0        1
Name: P6760, dtype: int64

Hay una gran similitud entre los valores de las columnas numéricas salvo P6760, para estas similares sugiero llenar los valores vacíos con la media y para las columnas P6400 y P6760 considero que lo mejor sería llenar los valores nulos con la moda pues hay una gran diferencia respecto a los demás valores.

In [362]:
fuerTrabajo['P6760'] = fuerTrabajo['P6760'].fillna(fuerTrabajo['P6760'].mode()[0])
fuerTrabajo['P6400'] = fuerTrabajo['P6400'].fillna(fuerTrabajo['P6400'].mode()[0])
fuerTrabajo['P6750'] = fuerTrabajo['P6750'].fillna(fuerTrabajo['P6750'].mean())
fuerTrabajo['P6500'] = fuerTrabajo['P6500'].fillna(fuerTrabajo['P6500'].mean())
In [363]:
cambiar_int2(fuerTrabajo)
missing_values_table(fuerTrabajo)
Out[363]:
Missing Values % of Total Values
DIRECTORIO 0 0.0
SECUENCIA_P 0 0.0
ORDEN 0 0.0
P6370S1 0 0.0
P6390S1 0 0.0
P6880 0 0.0
P6440 0 0.0
P6400 0 0.0
P1151 0 0.0
P1150 0 0.0
P1150S1 0 0.0
P1150S2 0 0.0
P1099S1 0 0.0
P1099S2 0 0.0
P427 0 0.0
P6500 0 0.0
P6750 0 0.0
P6760 0 0.0
P6426 0 0.0
P428 0 0.0
P6250 0 0.0
P6510 0 0.0
P6545 0 0.0
P1145 0 0.0
P1149S1 0 0.0
P1148S1 0 0.0

Análisis valores de las variables

In [364]:
for columna in fuerTrabajo.columns:
  print(columna,"\n",fuerTrabajo[columna].unique())
DIRECTORIO 
 [2915591. 2915595. 2915596. ... 2965177. 2965179. 2965180.]
SECUENCIA_P 
 [1 2 3 4 5 6]
ORDEN 
 [ 1.  2.  5.  6.  3.  4.  7.  9. 10.  8. 11. 12. 14. 15. 16. 17. 13. 18.]
P6370S1 
 [53. 45. 37. 95. 79. 97. 41. 75. 99. 55. 39. 58. 40. 61. 98. 51. 62. 54.
 21. 11. 44.  6.  8. 50. 30. 38.  3. 42. 13. 32. 64. 59. 33. 12. 88. 57.
 85. 93. 84. 81.  2. 60. 34. 92. 80. 77. 87. 83. 19.  7. 91. 56. 76.  0.
 90. 43.  9. 16. 15. 18. 49. 63. 20. 74.  4. 17. 70. 94. 86. 72. 31. 36.
 89.  1. 14. 71.  5. 35. 73. 96. 52. 78. 82.]
P6390S1 
 [5529. 5243. 5135. 5521. 4521. 1810. 4530. 5155. 5221.    0. 1750. 9000.
 5020. 5261. 6310. 5272. 5211. 5239. 5511. 7524. 5233.  116. 6041.  123.
 9500. 7512. 5241. 4100. 7412. 6512. 8511. 7513.  125.  121.  118. 6031.
 5137. 6421. 6516. 7493. 8043. 7523. 5125.  140.  501. 6021. 2610. 5271.
 8512. 3691. 9302. 5134. 7522. 8060. 5237. 5030. 2731. 7411. 4010. 6422.
 2893. 1120. 7492. 5169. 4541. 9242. 2090. 1594. 5234. 8532. 4522. 5040.
 1511. 5222. 3611.  112. 9241. 3710. 1110. 5127. 5229. 5224. 5052. 5262.
  115. 1939. 1730. 7250. 5236. 1921. 5231. 3720. 1551. 5252. 6412. 6042.
 7010. 8050. 5235. 4552. 2811. 5244. 6111. 6120. 5141. 5131. 5225. 8045.
 1589. 7421. 8515. 9309. 2529. 5170. 2424. 1572. 7499. 2109. 7514. 5011.
 9231. 1581. 6511. 7020. 5219. 1910. 2101. 1929. 2519. 2423. 8514. 5151.
 6601. 6596. 2924. 9212. 7494. 8011. 6592. 9301. 7130.  201. 2710. 6331.
 4542. 7430. 2694. 8042. 6599. 6023. 5251. 5512. 5223. 6022. 2422. 2511.
 1521. 6340. 9214. 1530. 9249. 5519. 1593. 5051. 5522. 8044. 3311. 5530.
 1931. 3699. 2212. 1720. 7414. 9303. 2231. 2421. 5136. 8520.  113. 1543.
  117.  130. 4560. 7530. 9191. 2220. 6333. 6320. 8041. 2102. 2899. 8022.
 8513. 2892. 6424. 1749. 7515. 7111. 1743. 2429. 2321. 7413. 7220. 6211.
 7491. 9199. 5161. 5153. 4559. 6411. 5123. 6519. 5012. 3190. 9111. 5232.
 5139. 8046. 6213. 5132. 9213. 8030. 1320. 1411. 5246. 5111. 1512. 7495.
 3530. 7230. 1741. 3410. 3693. 1924. 9219. 5249. 3430. 2030. 6514. 6043.
 1541. 5152.  119.  122. 1010. 3511. 8012. 1592. 9232.  124. 2412.  111.
 3614. 8519. 5523. 4020. 3130. 2891.  114. 2699. 1591. 6593. 3120.  202.
 2919. 7122. 5122. 5126. 1561. 8021. 7123. 1552. 5163. 2211. 1710. 6515.
 7511. 6712. 3000. 9211. 6715. 2930. 6423. 1522. 1742. 2695. 2693. 6039.
 5242. 2921. 4511. 6332. 2915. 6604. 1925. 6390. 3612. 2219. 2413. 2521.
 6112. 2912. 5133. 4512. 1926. 8531. 6425. 2233. 3613. 3694. 6212. 1571.
 7310. 2729. 2010. 9900. 5269. 5190. 3420. 3692. 1564. 5113. 3619. 2234.
 2929. 2925. 2691. 2692. 1563. 2411. 9220. 1600. 3110. 7521. 6426. 6713.
 2927. 7129. 7240. 3512. 5121. 3150. 6719. 2513. 9120. 4549. 9233. 2040.
 5245. 3320. 5124. 4543. 2812. 5159. 6722. 6339. 7112. 2512. 2020. 3592.
 2696.  129. 4030. 4551. 3140. 3591. 5524. 2240. 7290. 2926. 7210. 3312.
 5142. 3230. 2430. 6513. 5154. 6044. 3220. 7320. 2914. 1923. 1490. 6010.
 5112. 1922. 1820. 6032. 1932. 6214. 6595. 2923. 2414.]
P6880 
 [En esta vivienda, De puerta en puerta, Local fijo, oficina, fábrica, etc., En un vehículo, En otras viviendas, ..., Sitio al descubierto en la calle  (ambulante y..., En una obra en construcción, Otro, En kiosco - caseta, En una mina o cantera]
Length: 11
Categories (11, object): [En esta vivienda, De puerta en puerta, Local fijo, oficina, fábrica, etc.,
                          En un vehículo, ..., En una obra en construcción, Otro, En kiosco - caseta,
                          En una mina o cantera]
P6440 
 [No., Sí]
Categories (2, object): [No., Sí]
P6400 
 [Sí, No., No sabe, no informa.]
Categories (3, object): [Sí, No., No sabe, no informa.]
P1151 
 [  4.  45.  48.  40.  75.  50.  70.  54.  36.  44.  21.  84.  14.  28.
  30.  56.  18.  96.  42.  12.   9.  35.  72.  98.  80.  11.   8.  55.
  25.  77.  24.  27.  46.  32.  60.  31.  10.  37.  71.  20.  59. 126.
  58.  49.   7.  63.   2.   6.  66.   3. 100.  38.  52.  68. 112.  15.
  85.  78.  76.  90.  53.  16.  83.  64.  86. 140. 105.  39.   1.  65.
  62.  41. 119.  79.  91.   5.  67. 110. 108.  51.  73.  13.  89.  33.
  43. 120. 107.  82.  57.  97.  94.  87.  47.  61. 114. 133.  81.  22.
  74.  19.  26. 102.  34.  92. 104.  69.  88.  95.  23.  17. 115. 118.
 116.  93. 132. 117.  29. 101. 136. 127. 123. 106. 125. 128. 113.  99.
 130. 103.]
P1150 
 [Sí]
Categories (1, object): [Sí]
P1150S1 
 [5529. 5243. 5135. 5521. 4521. 1810. 4530. 5155. 5221.    0. 1750. 9000.
 5020. 5261. 6310. 5272. 5211. 5239. 5511. 7524. 5233.  116. 6041.  123.
 9500. 7512. 5241. 4100. 7412. 6512. 8511. 7513.  125.  121.  118. 6031.
 5137. 6421. 6516. 7493. 8043. 7523. 5125.  140.  501. 6021. 2610. 5271.
 8512. 3691. 9302. 5134. 7522. 8060. 5237. 5030. 2731. 7411. 4010. 6422.
 2893. 1120. 7492. 5169. 4541. 9242. 2090. 1594. 5234. 8532. 4522. 5040.
 1511. 5222. 3611.  112. 9241. 3710. 1110. 5127. 5229. 5224. 5052. 5262.
  115. 1939. 1730. 7250. 5236. 1921. 5231. 3720. 1551. 5252. 6412. 6042.
 7010. 8050. 5235. 4552. 2811. 5244. 6111. 6120. 5141. 5131. 5225. 8045.
 1589. 7421. 8515. 9309. 2529. 5170. 2424. 1572. 7499. 2109. 7514. 5011.
 9231. 1581. 6511. 7020. 5219. 1910. 2101. 1929. 2519. 2423. 8514. 5151.
 6601. 6596. 2924. 9212. 7494. 8011. 6592. 9301. 7130.  201. 2710. 6331.
 4542. 7430. 2694. 8042. 6599. 6023. 5251. 5512. 5223. 6022. 2422. 2511.
 1521. 6340. 9214. 1530. 9249. 5519. 1593. 5051. 5522. 8044. 3311. 5530.
 1931. 3699. 2212. 1720. 7414. 9303. 2231. 2421. 5136. 8520.  113. 1543.
  117.  130. 4560. 7530. 9191. 2220. 6333. 6320. 8041. 2102. 2899. 8022.
 8513. 2892. 6424. 1749. 7515. 7111. 1743. 2429. 2321. 7413. 7220. 6211.
 7491. 9199. 5161. 5153. 4559. 6411. 5123. 6519. 5012. 3190. 9111. 5232.
 5139. 8046. 6213. 5132. 9213. 8030. 1320. 1411. 5246. 5111. 1512. 7495.
 3530. 7230. 1741. 3410. 3693. 1924. 9219. 5249. 3430. 2030. 6514. 6043.
 1541. 5152.  119.  122. 1010. 3511. 8012. 1592. 9232.  124. 2412.  111.
 3614. 8519. 5523. 4020. 3130. 2891.  114. 2699. 1591. 6593. 3120.  202.
 2919. 7122. 5122. 5126. 1561. 8021. 7123. 1552. 5163. 2211. 1710. 6515.
 7511. 6712. 3000. 9211. 6715. 2930. 6423. 1522. 1742. 2695. 2693. 6039.
 5242. 2921. 4511. 6332. 2915. 6604. 1925. 6390. 3612. 2219. 2413. 2521.
 6112. 2912. 5133. 4512. 1926. 8531. 6425. 2233. 3613. 3694. 6212. 1571.
 7310. 2729. 2010. 9900. 5269. 5190. 3420. 3692. 1564. 5113. 3619. 2234.
 2929. 2925. 2691. 2692. 1563. 2411. 9220. 1600. 3110. 7521. 6426. 6713.
 2927. 7129. 7240. 3512. 5121. 3150. 6719. 2513. 9120. 4549. 9233. 2040.
 5245. 3320. 5124. 4543. 2812. 5159. 6722. 6339. 7112. 2512. 2020. 3592.
 2696.  129. 4030. 4551. 3140. 3591. 5524. 2240. 7290. 2926. 7210. 3312.
 5142. 3230. 2430. 6513. 5154. 6044. 3220. 7320. 2914. 1923. 1490. 6010.
 5112. 1922. 1820. 6032. 1932. 6214. 6595. 2923. 2414.]
P1150S2 
 [ 0. 30. 10.  8. 25. 15.  5. 40. 20. 45.  3. 50. 36.  1. 42. 12. 35.  2.]
P1099S1 
 [5529. 5243. 5135. 5521. 4521. 1810. 4530. 5155. 5221.    0. 1750. 9000.
 5020. 5261. 6310. 5272. 5211. 5239. 5511. 7524. 5233.  116. 6041.  123.
 9500. 7512. 5241. 4100. 7412. 6512. 8511. 7513.  125.  121.  118. 6031.
 5137. 6421. 6516. 7493. 8043. 7523. 5125.  140.  501. 6021. 2610. 5271.
 8512. 3691. 9302. 5134. 7522. 8060. 5237. 5030. 2731. 7411. 4010. 6422.
 2893. 1120. 7492. 5169. 4541. 9242. 2090. 1594. 5234. 8532. 4522. 5040.
 1511. 5222. 3611.  112. 9241. 3710. 1110. 5127. 5229. 5224. 5052. 5262.
  115. 1939. 1730. 7250. 5236. 1921. 5231. 3720. 1551. 5252. 6412. 6042.
 7010. 8050. 5235. 4552. 2811. 5244. 6111. 6120. 5141. 5131. 5225. 8045.
 1589. 7421. 8515. 9309. 2529. 5170. 2424. 1572. 7499. 2109. 7514. 5011.
 9231. 1581. 6511. 7020. 5219. 1910. 2101. 1929. 2519. 2423. 8514. 5151.
 6601. 6596. 2924. 9212. 7494. 8011. 6592. 9301. 7130.  201. 2710. 6331.
 4542. 7430. 2694. 8042. 6599. 6023. 5251. 5512. 5223. 6022. 2422. 2511.
 1521. 6340. 9214. 1530. 9249. 5519. 1593. 5051. 5522. 8044. 3311. 5530.
 1931. 3699. 2212. 1720. 7414. 9303. 2231. 2421. 5136. 8520.  113. 1543.
  117.  130. 4560. 7530. 9191. 2220. 6333. 6320. 8041. 2102. 2899. 8022.
 8513. 2892. 6424. 1749. 7515. 7111. 1743. 2429. 2321. 7413. 7220. 6211.
 7491. 9199. 5161. 5153. 4559. 6411. 5123. 6519. 5012. 3190. 9111. 5232.
 5139. 8046. 6213. 5132. 9213. 8030. 1320. 1411. 5246. 5111. 1512. 7495.
 3530. 7230. 1741. 3410. 3693. 1924. 9219. 5249. 3430. 2030. 6514. 6043.
 1541. 5152.  119.  122. 1010. 3511. 8012. 1592. 9232.  124. 2412.  111.
 3614. 8519. 5523. 4020. 3130. 2891.  114. 2699. 1591. 6593. 3120.  202.
 2919. 7122. 5122. 5126. 1561. 8021. 7123. 1552. 5163. 2211. 1710. 6515.
 7511. 6712. 3000. 9211. 6715. 2930. 6423. 1522. 1742. 2695. 2693. 6039.
 5242. 2921. 4511. 6332. 2915. 6604. 1925. 6390. 3612. 2219. 2413. 2521.
 6112. 2912. 5133. 4512. 1926. 8531. 6425. 2233. 3613. 3694. 6212. 1571.
 7310. 2729. 2010. 9900. 5269. 5190. 3420. 3692. 1564. 5113. 3619. 2234.
 2929. 2925. 2691. 2692. 1563. 2411. 9220. 1600. 3110. 7521. 6426. 6713.
 2927. 7129. 7240. 3512. 5121. 3150. 6719. 2513. 9120. 4549. 9233. 2040.
 5245. 3320. 5124. 4543. 2812. 5159. 6722. 6339. 7112. 2512. 2020. 3592.
 2696.  129. 4030. 4551. 3140. 3591. 5524. 2240. 7290. 2926. 7210. 3312.
 5142. 3230. 2430. 6513. 5154. 6044. 3220. 7320. 2914. 1923. 1490. 6010.
 5112. 1922. 1820. 6032. 1932. 6214. 6595. 2923. 2414.]
P1099S2 
 [ 0. 30. 20.  8. 10. 15. 40.  5.  1. 25. 45. 35.  3. 50. 12.  2. 22. 55.
 18.  6.  7. 17.  4. 59. 38. 21.  9. 16. 14. 23. 13. 32. 24.]
P427 
 [Trabajador por cuenta propia, Obrero o empleado de empresa particular, Patrón o empleador, Obrero o empleado del gobierno, Trabajador de su propia finca o de finca en ar..., Empleado doméstico, Jornalero o Peón]
Categories (7, object): [Trabajador por cuenta propia, Obrero o empleado de empresa particular,
                         Patrón o empleador, Obrero o empleado del gobierno,
                         Trabajador de su propia finca o de finca en ar..., Empleado doméstico, Jornalero o Peón]
P6500 
 [5529. 5243. 5135. 5521. 4521. 1810. 4530. 5155. 5221.    0. 1750. 9000.
 5020. 5261. 6310. 5272. 5211. 5239. 5511. 7524. 5233.  116. 6041.  123.
 9500. 7512. 5241. 4100. 7412. 6512. 8511. 7513.  125.  121.  118. 6031.
 5137. 6421. 6516. 7493. 8043. 7523. 5125.  140.  501. 6021. 2610. 5271.
 8512. 3691. 9302. 5134. 7522. 8060. 5237. 5030. 2731. 7411. 4010. 6422.
 2893. 1120. 7492. 5169. 4541. 9242. 2090. 1594. 5234. 8532. 4522. 5040.
 1511. 5222. 3611.  112. 9241. 3710. 1110. 5127. 5229. 5224. 5052. 5262.
  115. 1939. 1730. 7250. 5236. 1921. 5231. 3720. 1551. 5252. 6412. 6042.
 7010. 8050. 5235. 4552. 2811. 5244. 6111. 6120. 5141. 5131. 5225. 8045.
 1589. 7421. 8515. 9309. 2529. 5170. 2424. 1572. 7499. 2109. 7514. 5011.
 9231. 1581. 6511. 7020. 5219. 1910. 2101. 1929. 2519. 2423. 8514. 5151.
 6601. 6596. 2924. 9212. 7494. 8011. 6592. 9301. 7130.  201. 2710. 6331.
 4542. 7430. 2694. 8042. 6599. 6023. 5251. 5512. 5223. 6022. 2422. 2511.
 1521. 6340. 9214. 1530. 9249. 5519. 1593. 5051. 5522. 8044. 3311. 5530.
 1931. 3699. 2212. 1720. 7414. 9303. 2231. 2421. 5136. 8520.  113. 1543.
  117.  130. 4560. 7530. 9191. 2220. 6333. 6320. 8041. 2102. 2899. 8022.
 8513. 2892. 6424. 1749. 7515. 7111. 1743. 2429. 2321. 7413. 7220. 6211.
 7491. 9199. 5161. 5153. 4559. 6411. 5123. 6519. 5012. 3190. 9111. 5232.
 5139. 8046. 6213. 5132. 9213. 8030. 1320. 1411. 5246. 5111. 1512. 7495.
 3530. 7230. 1741. 3410. 3693. 1924. 9219. 5249. 3430. 2030. 6514. 6043.
 1541. 5152.  119.  122. 1010. 3511. 8012. 1592. 9232.  124. 2412.  111.
 3614. 8519. 5523. 4020. 3130. 2891.  114. 2699. 1591. 6593. 3120.  202.
 2919. 7122. 5122. 5126. 1561. 8021. 7123. 1552. 5163. 2211. 1710. 6515.
 7511. 6712. 3000. 9211. 6715. 2930. 6423. 1522. 1742. 2695. 2693. 6039.
 5242. 2921. 4511. 6332. 2915. 6604. 1925. 6390. 3612. 2219. 2413. 2521.
 6112. 2912. 5133. 4512. 1926. 8531. 6425. 2233. 3613. 3694. 6212. 1571.
 7310. 2729. 2010. 9900. 5269. 5190. 3420. 3692. 1564. 5113. 3619. 2234.
 2929. 2925. 2691. 2692. 1563. 2411. 9220. 1600. 3110. 7521. 6426. 6713.
 2927. 7129. 7240. 3512. 5121. 3150. 6719. 2513. 9120. 4549. 9233. 2040.
 5245. 3320. 5124. 4543. 2812. 5159. 6722. 6339. 7112. 2512. 2020. 3592.
 2696.  129. 4030. 4551. 3140. 3591. 5524. 2240. 7290. 2926. 7210. 3312.
 5142. 3230. 2430. 6513. 5154. 6044. 3220. 7320. 2914. 1923. 1490. 6010.
 5112. 1922. 1820. 6032. 1932. 6214. 6595. 2923. 2414.]
P6750 
 [9.00000000e+04 6.62456974e+05 6.00000000e+05 5.00000000e+05
 7.00000000e+05 1.20000000e+06 2.79000000e+05 7.50000000e+02
 1.00000000e+05 6.00000000e+04 4.50000000e+05 3.00000000e+05
 9.00000000e+05 6.18200000e+06 0.00000000e+00 1.50000000e+06
 2.38000000e+06 3.30000000e+06 9.90000000e+01 3.80000000e+06
 2.40000000e+05 2.00000000e+05 4.00000000e+05 3.50000000e+05
 1.60000000e+04 1.20000000e+05 3.20000000e+05 2.60000000e+05
 5.00000000e+04 1.30000000e+06 3.00000000e+06 5.36000000e+05
 8.00000000e+05 5.50000000e+05 7.20000000e+05 3.90000000e+05
 9.50000000e+05 5.00000000e+03 5.67000000e+05 2.50000000e+05
 3.50000000e+04 1.00000000e+06 1.10000000e+06 1.50000000e+05
 5.66700000e+05 5.60000000e+05 1.25000000e+06 6.20000000e+05
 2.30000000e+06 9.80000000e+01 1.40000000e+06 7.00000000e+06
 4.00000000e+04 7.60000000e+05 1.10000000e+05 7.50000000e+05
 2.30000000e+05 1.30000000e+05 2.00000000e+06 4.50000000e+04
 2.50000000e+06 5.20000000e+05 1.80000000e+06 7.00000000e+04
 3.50000000e+06 8.00000000e+04 1.00000000e+04 3.60000000e+05
 2.60000000e+06 1.20000000e+04 2.70000000e+05 4.80000000e+05
 2.80000000e+05 5.45000000e+05 1.60000000e+06 8.68000000e+05
 2.50000000e+04 3.40000000e+05 4.00000000e+06 1.80000000e+05
 2.34000000e+05 3.00000000e+04 1.82000000e+05 2.83350000e+05
 3.01600000e+05 2.16000000e+05 8.40000000e+05 6.60000000e+05
 1.35000000e+05 6.50000000e+05 5.66000000e+05 2.24000000e+05
 6.18000000e+05 8.20000000e+05 2.10000000e+05 5.86000000e+05
 4.40000000e+05 6.00000000e+06 1.60000000e+05 4.50000000e+06
 2.27000000e+05 3.70000000e+06 2.62000000e+06 3.51000000e+05
 5.80000000e+05 5.76700000e+05 3.70000000e+05 5.00000000e+06
 5.70000000e+05 4.60000000e+05 1.26000000e+05 1.13000000e+05
 2.00000000e+04 5.35000000e+05 5.57500000e+05 1.40000000e+05
 3.20000000e+04 8.50000000e+05 9.60000000e+04 1.65000000e+06
 5.65000000e+05 3.75000000e+05 2.40000000e+06 5.50000000e+06
 1.20000000e+07 1.00000000e+07 4.30000000e+05 1.24800000e+06
 1.50000000e+04 9.60000000e+05 2.90000000e+05 2.00000000e+03
 1.36000000e+05 2.20000000e+05 5.40000000e+05 5.67200000e+05
 2.61000000e+05 2.10000000e+06 1.28100000e+06 1.90000000e+05
 2.00000000e+01 8.00000000e+06 3.20000000e+06 2.50000000e+07
 2.20000000e+06 1.59600000e+06 1.50000000e+07 3.78000000e+05
 3.30000000e+05 1.56000000e+05 5.67700000e+05 6.30000000e+06
 3.60000000e+04 1.70000000e+05 4.32000000e+05 3.85000000e+05
 4.20000000e+05 1.70000000e+06 3.60000000e+06 5.65500000e+05
 7.56000000e+05 1.20000000e+01 1.24000000e+05 6.80000000e+05
 7.00000000e+03 5.46000000e+05 5.68000000e+05 7.50000000e+04
 2.99200000e+06 5.76000000e+05 6.30000000e+05 7.80000000e+05
 5.67600000e+05 1.96000000e+06 1.00100000e+03 3.36000000e+05
 1.00010000e+04 3.80000000e+05 9.80000000e+05 3.15000000e+05
 4.20000000e+06 2.76000000e+05 5.12000000e+05 1.80000000e+04
 3.12000000e+05 1.38000000e+06 6.40000000e+04 1.25000000e+05
 8.70000000e+04 8.80000000e+04 6.70000000e+05 2.40000000e+04
 4.70000000e+05 8.80000000e+05 3.80000000e+04 6.38000000e+05
 2.34500000e+05 2.20000000e+04 2.66000000e+05 2.80000000e+06
 6.80000000e+04 5.50000000e+04 2.70000000e+06 4.10000000e+05
 4.68000000e+05 1.92000000e+05 5.95000000e+05 2.42000000e+05
 2.75000000e+06 2.48000000e+05 8.40000000e+04 6.34000000e+05
 1.08000000e+05 5.63700000e+05 1.00000000e+02 1.44000000e+05
 1.12000000e+05 5.66300000e+05 4.66300000e+05 6.55000000e+05
 5.60700000e+05 8.78100000e+05 6.40000000e+05 1.00000000e+00
 5.66500000e+05 5.90000000e+05 1.67000000e+06 8.00000000e+03
 1.85000000e+05 5.56700000e+05 1.00001000e+05 4.80000000e+06
 5.52000000e+05 1.87000000e+05 2.26000000e+05 1.89600000e+05
 9.98000000e+05 3.57000000e+05 9.80000000e+04 5.65700000e+05
 7.15000000e+05 1.65000000e+05 1.83000000e+06 1.46000000e+05
 7.75000000e+05 8.70000000e+05 1.21500000e+06 1.05000000e+06
 2.86000000e+05 3.88000000e+06 2.94000000e+05 3.70000000e+04
 1.96000000e+05 2.84000000e+05 6.80000000e+06 5.30000000e+05
 1.75000000e+06 2.80000000e+04 7.65000000e+05 4.80000000e+04
 7.70000000e+05 5.28000000e+05 9.00000000e+03 7.30000000e+04
 2.88000000e+05 3.10000000e+05 2.65000000e+05 3.25000000e+05
 4.08000000e+05 2.12000000e+05 1.02000000e+07 4.05000000e+05
 4.50000000e+02 1.58700000e+06 3.40000000e+06 2.90000000e+06
 1.30000000e+04 1.04000000e+06 1.76000000e+05 5.08000000e+05
 1.90000000e+06 2.32000000e+05 7.20000000e+04 4.20000000e+04
 2.46000000e+05 1.35000000e+06 2.15000000e+05 5.10000000e+05
 6.67000000e+05 5.64000000e+05 8.25000000e+05 1.05000000e+07
 2.60000000e+04 1.12000000e+06 2.28700000e+06 6.90000000e+05
 2.24000000e+06 7.40000000e+05 5.66800000e+05 1.08300000e+06
 1.32000000e+05 5.66900000e+05 1.36000000e+06 1.42000000e+05
 5.77600000e+05 9.50000000e+06 6.09000000e+05 3.00000000e+07
 9.50000000e+04 5.66600000e+05 6.50000000e+06 2.85000000e+06
 7.80000000e+06 5.63000000e+05 8.50000000e+04 3.00000000e+02
 5.15000000e+05 8.47000000e+05 6.10000000e+05 5.60000000e+04
 6.20000000e+04 4.90000000e+05 3.05000000e+05 6.22000000e+05
 8.48000000e+05 5.25000000e+05 5.32000000e+05 4.72000000e+05
 5.97700000e+05 2.25000000e+06 5.40000000e+04 2.72000000e+05
 4.48000000e+05 9.20000000e+05 5.67800000e+05 5.89500000e+05
 5.89000000e+05 3.66000000e+05 1.05400000e+06 8.90000000e+05
 2.75000000e+05 5.60000000e+06 6.50000000e+04 1.55000000e+05
 4.10000000e+06 8.60000000e+04 5.93000000e+05 1.64000000e+05
 5.40000000e+06 1.15000000e+06 1.42000000e+06 7.50000000e+06
 1.18500000e+06 2.96000000e+05 1.24000000e+06 1.38900000e+06
 3.40000000e+04 5.19500000e+05 1.89000000e+06 4.89000000e+05
 1.45000000e+06 7.20000000e+06 7.85000000e+05 3.20000000e+02
 3.48000000e+05 5.86700000e+05 2.45000000e+06 5.98000000e+05
 1.92000000e+06 4.60000000e+04 9.40000000e+04 5.89600000e+05
 9.00000000e+00 9.00000000e+06 1.57000000e+05 1.21000000e+06
 5.88900000e+05 7.35000000e+05 5.83000000e+05 1.23000000e+06
 5.85000000e+05 5.96000000e+05 9.60000000e+01 4.35000000e+05
 2.25000000e+05 5.89700000e+05 8.60000000e+05 4.30000000e+06
 3.92000000e+05 1.66000000e+05 5.87000000e+05 1.12000000e+07
 3.86000000e+05 6.00000000e+03 6.35000000e+05 6.12000000e+05
 2.35000000e+05 3.25000000e+06 8.30000000e+05 1.28000000e+06
 5.89900000e+05 1.46700000e+06 1.40000000e+04 9.52000000e+05
 7.30000000e+05 6.70000000e+06 3.65000000e+05 3.06000000e+05
 1.09000000e+06 1.56000000e+06 5.72000000e+05 1.05000000e+05
 1.38000000e+05 1.95000000e+06 9.60000000e+06 5.67500000e+05
 5.87600000e+05 2.22700000e+06 1.08000000e+06 2.32000000e+06
 1.18000000e+06 3.64000000e+05 2.37000000e+05 3.24000000e+05
 5.86500000e+05 6.25000000e+05 1.12600000e+06 1.01100000e+06
 1.02000000e+06 1.62000000e+06 8.50000000e+06 3.90000000e+06
 8.62000000e+05 1.28000000e+05 1.75000000e+05 9.40000000e+05
 5.95500000e+05 3.58000000e+05]
P6760 
 [ 1.  5. 24.  2. 12.  4.  3. 20.  6. 10. 17.  7.  8. 22. 18.  9.]
P6426 
 [ 12.   6.   7.  24. 360.  48. 144.   2. 252.  40.  96.   1.  18.  20.
  30. 600. 192. 960.  72.  84.   4. 180.  36.   3.  60.  16.   8.   5.
  25. 128. 480. 240.  10. 120.  15.  54. 168. 125.   9.  26. 290. 156.
 300. 696. 500.  13. 456. 216. 130. 150.  50. 288.  70.  46. 255. 228.
 160.  42. 106.  11. 204. 132.   0. 520.  44.  52.  90. 768.  14. 312.
  35. 348.  86. 223.  23. 108.  58. 149. 244. 148.  82.  32.  19.  62.
  34. 672. 222. 336. 126.  80. 414.  33. 420. 276. 232. 210. 214. 124.
  67. 224.  69. 123. 860. 608.  66.  68. 264. 135.  91. 262. 100.  78.
  53. 170. 266. 134.  29. 380. 233. 220. 102.  45. 864. 140. 612. 164.
  21.  99. 540. 460. 320. 121.  76. 310.  17. 560. 384. 516. 177. 324.
 268. 444. 176. 427. 800. 200. 208. 350.  38.  22. 632. 242.  28.  56.
 400. 396. 545. 249. 325. 256.  27. 260.  88. 636.  94. 720. 510.  37.
 250. 198. 408. 744.  98. 366.  31. 390. 284. 536. 372. 122. 146. 136.
 640. 580. 328. 576. 326. 174. 259. 492. 118. 424.  55. 504. 354. 322.
 448.  41. 432. 660. 552.  63.  43.  49. 486. 438. 114. 468. 194.  64.
  83.  39. 295. 245. 658. 282. 129.  81. 104. 234. 280. 278.  92. 133.
 239.  51.  97.  75. 184. 153. 190. 230. 346.  65. 229. 524. 450. 243.
  59. 158. 211. 212. 105. 237. 550. 375. 364. 117. 203. 297. 345.  61.
 792. 119. 225. 196. 528. 241.  85. 138. 231. 618. 152. 373.  47.  89.
 165. 254. 145.  93.  57. 304. 624. 248. 370. 780.  87. 352. 238. 166.
 162. 110. 286.  73. 327. 365.  74. 270. 109. 189. 272.  95. 340. 186.
 195. 263. 159. 485. 700. 564. 185. 175. 139. 258. 172. 302. 440.  79.
 115. 183. 287. 226. 113. 393. 217. 369. 404. 648. 708. 900. 596. 852.
 684. 179. 202. 410. 101. 358. 206. 344. 142. 154. 588. 834. 398. 103.
 143. 178. 392. 155. 559. 182. 840. 314. 434. 215. 127. 169. 236. 251.
 298. 391.  71. 422. 116. 356. 299. 368. 376. 406. 430. 810. 131. 374.
 385. 556. 246. 428. 289. 112. 332. 680. 423. 235. 546. 462. 285. 294.
 274. 379. 318. 181. 334. 568. 269. 265. 111. 157. 401. 296. 470. 732.
 416. 620. 218. 205. 483. 279. 247. 187. 338. 357. 630. 527. 394. 359.
 188. 315. 305. 253. 330. 650. 193. 459. 490. 173. 465. 167. 435. 760.
 207. 267. 487. 512. 706. 489. 353. 362. 820. 147. 522. 425. 221. 402.
 950. 484. 377. 876. 341. 389. 509. 570. 308. 467. 821. 475. 261. 292.
 452. 199.]
P428 
 [Trabaja solo, 10 a 50 personas, 51 personas o más, 2 a 4 personas, 5 a 9 personas]
Categories (5, object): [Trabaja solo, 10 a 50 personas, 51 personas o más, 2 a 4 personas,
                         5 a 9 personas]
P6250 
 [No, Sí]
Categories (2, object): [No, Sí]
P6510 
 [No, Sí]
Categories (2, object): [No, Sí]
P6545 
 [No., Sí]
Categories (2, object): [No., Sí]
P1145 
 [No., Sí]
Categories (2, object): [No., Sí]
P1149S1 
 [5529. 5243. 5135. 5521. 4521. 1810. 4530. 5155. 5221.    0. 1750. 9000.
 5020. 5261. 6310. 5272. 5211. 5239. 5511. 7524. 5233.  116. 6041.  123.
 9500. 7512. 5241. 4100. 7412. 6512. 8511. 7513.  125.  121.  118. 6031.
 5137. 6421. 6516. 7493. 8043. 7523. 5125.  140.  501. 6021. 2610. 5271.
 8512. 3691. 9302. 5134. 7522. 8060. 5237. 5030. 2731. 7411. 4010. 6422.
 2893. 1120. 7492. 5169. 4541. 9242. 2090. 1594. 5234. 8532. 4522. 5040.
 1511. 5222. 3611.  112. 9241. 3710. 1110. 5127. 5229. 5224. 5052. 5262.
  115. 1939. 1730. 7250. 5236. 1921. 5231. 3720. 1551. 5252. 6412. 6042.
 7010. 8050. 5235. 4552. 2811. 5244. 6111. 6120. 5141. 5131. 5225. 8045.
 1589. 7421. 8515. 9309. 2529. 5170. 2424. 1572. 7499. 2109. 7514. 5011.
 9231. 1581. 6511. 7020. 5219. 1910. 2101. 1929. 2519. 2423. 8514. 5151.
 6601. 6596. 2924. 9212. 7494. 8011. 6592. 9301. 7130.  201. 2710. 6331.
 4542. 7430. 2694. 8042. 6599. 6023. 5251. 5512. 5223. 6022. 2422. 2511.
 1521. 6340. 9214. 1530. 9249. 5519. 1593. 5051. 5522. 8044. 3311. 5530.
 1931. 3699. 2212. 1720. 7414. 9303. 2231. 2421. 5136. 8520.  113. 1543.
  117.  130. 4560. 7530. 9191. 2220. 6333. 6320. 8041. 2102. 2899. 8022.
 8513. 2892. 6424. 1749. 7515. 7111. 1743. 2429. 2321. 7413. 7220. 6211.
 7491. 9199. 5161. 5153. 4559. 6411. 5123. 6519. 5012. 3190. 9111. 5232.
 5139. 8046. 6213. 5132. 9213. 8030. 1320. 1411. 5246. 5111. 1512. 7495.
 3530. 7230. 1741. 3410. 3693. 1924. 9219. 5249. 3430. 2030. 6514. 6043.
 1541. 5152.  119.  122. 1010. 3511. 8012. 1592. 9232.  124. 2412.  111.
 3614. 8519. 5523. 4020. 3130. 2891.  114. 2699. 1591. 6593. 3120.  202.
 2919. 7122. 5122. 5126. 1561. 8021. 7123. 1552. 5163. 2211. 1710. 6515.
 7511. 6712. 3000. 9211. 6715. 2930. 6423. 1522. 1742. 2695. 2693. 6039.
 5242. 2921. 4511. 6332. 2915. 6604. 1925. 6390. 3612. 2219. 2413. 2521.
 6112. 2912. 5133. 4512. 1926. 8531. 6425. 2233. 3613. 3694. 6212. 1571.
 7310. 2729. 2010. 9900. 5269. 5190. 3420. 3692. 1564. 5113. 3619. 2234.
 2929. 2925. 2691. 2692. 1563. 2411. 9220. 1600. 3110. 7521. 6426. 6713.
 2927. 7129. 7240. 3512. 5121. 3150. 6719. 2513. 9120. 4549. 9233. 2040.
 5245. 3320. 5124. 4543. 2812. 5159. 6722. 6339. 7112. 2512. 2020. 3592.
 2696.  129. 4030. 4551. 3140. 3591. 5524. 2240. 7290. 2926. 7210. 3312.
 5142. 3230. 2430. 6513. 5154. 6044. 3220. 7320. 2914. 1923. 1490. 6010.
 5112. 1922. 1820. 6032. 1932. 6214. 6595. 2923. 2414.]
P1148S1 
 [5529. 5243. 5135. 5521. 4521. 1810. 4530. 5155. 5221.    0. 1750. 9000.
 5020. 5261. 6310. 5272. 5211. 5239. 5511. 7524. 5233.  116. 6041.  123.
 9500. 7512. 5241. 4100. 7412. 6512. 8511. 7513.  125.  121.  118. 6031.
 5137. 6421. 6516. 7493. 8043. 7523. 5125.  140.  501. 6021. 2610. 5271.
 8512. 3691. 9302. 5134. 7522. 8060. 5237. 5030. 2731. 7411. 4010. 6422.
 2893. 1120. 7492. 5169. 4541. 9242. 2090. 1594. 5234. 8532. 4522. 5040.
 1511. 5222. 3611.  112. 9241. 3710. 1110. 5127. 5229. 5224. 5052. 5262.
  115. 1939. 1730. 7250. 5236. 1921. 5231. 3720. 1551. 5252. 6412. 6042.
 7010. 8050. 5235. 4552. 2811. 5244. 6111. 6120. 5141. 5131. 5225. 8045.
 1589. 7421. 8515. 9309. 2529. 5170. 2424. 1572. 7499. 2109. 7514. 5011.
 9231. 1581. 6511. 7020. 5219. 1910. 2101. 1929. 2519. 2423. 8514. 5151.
 6601. 6596. 2924. 9212. 7494. 8011. 6592. 9301. 7130.  201. 2710. 6331.
 4542. 7430. 2694. 8042. 6599. 6023. 5251. 5512. 5223. 6022. 2422. 2511.
 1521. 6340. 9214. 1530. 9249. 5519. 1593. 5051. 5522. 8044. 3311. 5530.
 1931. 3699. 2212. 1720. 7414. 9303. 2231. 2421. 5136. 8520.  113. 1543.
  117.  130. 4560. 7530. 9191. 2220. 6333. 6320. 8041. 2102. 2899. 8022.
 8513. 2892. 6424. 1749. 7515. 7111. 1743. 2429. 2321. 7413. 7220. 6211.
 7491. 9199. 5161. 5153. 4559. 6411. 5123. 6519. 5012. 3190. 9111. 5232.
 5139. 8046. 6213. 5132. 9213. 8030. 1320. 1411. 5246. 5111. 1512. 7495.
 3530. 7230. 1741. 3410. 3693. 1924. 9219. 5249. 3430. 2030. 6514. 6043.
 1541. 5152.  119.  122. 1010. 3511. 8012. 1592. 9232.  124. 2412.  111.
 3614. 8519. 5523. 4020. 3130. 2891.  114. 2699. 1591. 6593. 3120.  202.
 2919. 7122. 5122. 5126. 1561. 8021. 7123. 1552. 5163. 2211. 1710. 6515.
 7511. 6712. 3000. 9211. 6715. 2930. 6423. 1522. 1742. 2695. 2693. 6039.
 5242. 2921. 4511. 6332. 2915. 6604. 1925. 6390. 3612. 2219. 2413. 2521.
 6112. 2912. 5133. 4512. 1926. 8531. 6425. 2233. 3613. 3694. 6212. 1571.
 7310. 2729. 2010. 9900. 5269. 5190. 3420. 3692. 1564. 5113. 3619. 2234.
 2929. 2925. 2691. 2692. 1563. 2411. 9220. 1600. 3110. 7521. 6426. 6713.
 2927. 7129. 7240. 3512. 5121. 3150. 6719. 2513. 9120. 4549. 9233. 2040.
 5245. 3320. 5124. 4543. 2812. 5159. 6722. 6339. 7112. 2512. 2020. 3592.
 2696.  129. 4030. 4551. 3140. 3591. 5524. 2240. 7290. 2926. 7210. 3312.
 5142. 3230. 2430. 6513. 5154. 6044. 3220. 7320. 2914. 1923. 1490. 6010.
 5112. 1922. 1820. 6032. 1932. 6214. 6595. 2923. 2414.]

De acuerdo al diccionario los valores son válidos.

D. COMPOSICION DEL HOGAR

In [365]:
compHogar = pd.read_spss('D.sav')
In [366]:
compHogar.head()
Out[366]:
DIRECTORIO SECUENCIA_P ORDEN P6040 P6020 P425 P1174 P1174S1 P1174S1A1 P1174S2 P1174S2A1 P1174S3 P1174S3A1 P1173 P426 P1172 P1172S1 P5762 P5762S2 P5754 P5754S2
0 2915591.0 1.0 1.0 51.0 Mujer Jefe(a) del hogar NaN NaN NaN NaN NaN NaN NaN Ninguno de los anteriores Está separado(a) o divorciado(a) NaN NaN No NaN No NaN
1 2915592.0 1.0 1.0 63.0 Mujer Jefe(a) del hogar NaN NaN NaN NaN NaN NaN NaN Negro, mulato (afrodescendiente) Está separado(a) o divorciado(a) NaN NaN No NaN No NaN
2 2915593.0 1.0 1.0 38.0 Mujer Jefe(a) del hogar No NaN NaN NaN NaN NaN NaN Ninguno de los anteriores Está separado(a) o divorciado(a) NaN NaN No NaN No NaN
3 2915593.0 1.0 2.0 15.0 Mujer Hijo(a), Hijastro(a) NaN NaN NaN NaN NaN NaN NaN Ninguno de los anteriores Está soltero(a) NaN NaN 1.0 No NaN
4 2915593.0 1.0 3.0 7.0 Mujer Hijo(a), Hijastro(a) NaN NaN NaN NaN NaN NaN NaN Ninguno de los anteriores NaN NaN NaN 1.0 No NaN

Análisis del tipo de variables

In [367]:
compHogar.dtypes
Out[367]:
DIRECTORIO      float64
SECUENCIA_P     float64
ORDEN           float64
P6040           float64
P6020          category
P425           category
P1174          category
P1174S1        category
P1174S1A1       float64
P1174S2        category
P1174S2A1       float64
P1174S3        category
P1174S3A1       float64
P1173          category
P426           category
P1172          category
P1172S1         float64
P5762          category
P5762S2         float64
P5754          category
P5754S2         float64
dtype: object

Las columnas SECUENCIA_P, P6040, P1174S1A1, P1174S2A1, P1144S3A1, P576252 y P575452 corresponden a valores discretos por lo que es necesario pasarlos a tipo entero

In [368]:
def cambiar_int3(compHogar):
  columnas = ["SECUENCIA_P", "P6040", "P1174S1A1", "P1174S2A1", "P1144S3A1", "P576252", "P575452"]
  columnas.remove('P1174S1A1') #Las remuevo pues más adelante se eliminarán
  columnas.remove('P1174S2A1')
  columnas.remove('P1144S3A1')
  columnas.remove('P576252')
  columnas.remove('P575452')
  for columna in columnas:
    compHogar[columna]=compHogar[columna].astype(int)

Datos duplicados

In [369]:
duplicados = compHogar.duplicated().sum()
print(duplicados)
compHogar[compHogar.duplicated()]
0
Out[369]:
DIRECTORIO SECUENCIA_P ORDEN P6040 P6020 P425 P1174 P1174S1 P1174S1A1 P1174S2 P1174S2A1 P1174S3 P1174S3A1 P1173 P426 P1172 P1172S1 P5762 P5762S2 P5754 P5754S2

Datos faltantes

In [370]:
faltantes = missing_values_table(compHogar)
faltantes
Out[370]:
Missing Values % of Total Values
DIRECTORIO 0 0.000000
SECUENCIA_P 0 0.000000
ORDEN 0 0.000000
P6040 0 0.000000
P6020 0 0.000000
P425 0 0.000000
P1174 110647 74.513779
P1174S1 126423 85.137920
P1174S1A1 126423 85.137920
P1174S2 145414 97.927161
P1174S2A1 145414 97.927161
P1174S3 147841 99.561593
P1174S3A1 147841 99.561593
P1173 0 0.000000
P426 30091 20.264391
P1172 91519 61.632276
P1172S1 94568 63.685586
P5762 0 0.000000
P5762S2 83695 56.363306
P5754 0 0.000000
P5754S2 109387 73.665248

Encontramos bastantes columnas con más del 80% de sus valores como nulos por lo que serán las primeras en ser eliminadas pues al verificar en el diccionario se puede evidenciar que salvo las variables P1174 y P1172 son ellas quienes permiten especificar la respuesta a una pregunta previa

In [371]:
a_remover=[]
for columna in compHogar.columns:
  if faltantes.loc[columna,'% of Total Values'] >= 80 and columna not in ["P1174","P1172"]:
    a_remover.append(columna)
compHogar.drop(axis=1,columns=a_remover,inplace=True)
missing_values_table(compHogar)
Out[371]:
Missing Values % of Total Values
DIRECTORIO 0 0.000000
SECUENCIA_P 0 0.000000
ORDEN 0 0.000000
P6040 0 0.000000
P6020 0 0.000000
P425 0 0.000000
P1174 110647 74.513779
P1173 0 0.000000
P426 30091 20.264391
P1172 91519 61.632276
P1172S1 94568 63.685586
P5762 0 0.000000
P5762S2 83695 56.363306
P5754 0 0.000000
P5754S2 109387 73.665248

Ahora vamos a dejar las filas que tengan 13 columnas llenas de las 15

In [372]:
compHogar.dropna(thresh=13,inplace=True)
missing_values_table(compHogar)
Out[372]:
Missing Values % of Total Values
DIRECTORIO 0 0.000000
SECUENCIA_P 0 0.000000
ORDEN 0 0.000000
P6040 0 0.000000
P6020 0 0.000000
P425 0 0.000000
P1174 2711 9.839219
P1173 0 0.000000
P426 0 0.000000
P1172 65 0.235909
P1172S1 362 1.313832
P5762 0 0.000000
P5762S2 24583 89.220775
P5754 0 0.000000
P5754S2 25953 94.193010
In [373]:
for columna in ['P1172','P1172S1','P5762S2','P5754S2','P1174']:
  print(compHogar[columna].value_counts())
Sí    27191
No      297
Name: P1172, dtype: int64
2.0     24697
4.0       632
1.0       614
3.0       475
5.0       356
6.0       176
7.0       100
8.0        63
9.0        38
10.0       18
11.0        9
12.0        4
13.0        4
16.0        2
15.0        1
19.0        1
22.0        1
Name: P1172S1, dtype: int64
2.0     1001
1.0      924
4.0      305
5.0      297
3.0      180
6.0      154
7.0       59
8.0       35
9.0        8
11.0       4
10.0       3
Name: P5762S2, dtype: int64
1.0     1072
2.0      162
4.0       99
5.0       95
3.0       66
6.0       57
7.0       30
8.0       12
9.0        3
11.0       1
13.0       1
10.0       1
12.0       1
Name: P5754S2, dtype: int64
Sí    18045
No     6797
Name: P1174, dtype: int64

Para estos valores nulos considero que lo mejor sería completarlos de acuerdo a la probabilidad de ocurrencia de los distintos valores en la columna

In [374]:
cambiar_int3(compHogar)
for columna in ['P1172','P1172S1','P5762S2','P5754S2','P1174']:
  s = compHogar[columna].value_counts(normalize=True)
  missing = compHogar[columna].isnull()
  compHogar.loc[missing,columna] = np.random.choice(s.index, size=len(compHogar[missing]),p=s.values)
missing_values_table(compHogar)
Out[374]:
Missing Values % of Total Values
DIRECTORIO 0 0.0
SECUENCIA_P 0 0.0
ORDEN 0 0.0
P6040 0 0.0
P6020 0 0.0
P425 0 0.0
P1174 0 0.0
P1173 0 0.0
P426 0 0.0
P1172 0 0.0
P1172S1 0 0.0
P5762 0 0.0
P5762S2 0 0.0
P5754 0 0.0
P5754S2 0 0.0

Análisis valores de las variables

In [375]:
for columna in compHogar.columns:
  print(columna,"\n",compHogar[columna].unique())
DIRECTORIO 
 [2915594. 2915595. 2915596. ... 2965176. 2965177. 2965178.]
SECUENCIA_P 
 [1 2 3 4]
ORDEN 
 [ 1.  2.  3.  5.  6.  4. 10.  7.  8. 15.  9. 11. 12. 14. 18. 21.]
P6040 
 [ 48  25  52  57  51  46  23  26  42  34  67  65  79  38  36  31  28  49
  37  40  41  77  27  56  66  32  39  22  50  69  84  47  73  29  70  59
  30  58  43  55  75  64  63  62  19  44  45  53  21  76  68  33  35  72
  24  82  81  60  54  17  61  78  80  18  74  71  15  20  16  83  87  94
  85  86  89  88  90  91  92  93 103  96  95  14  98]
P6020 
 [Hombre, Mujer]
Categories (2, object): [Hombre, Mujer]
P425 
 [Jefe(a) del hogar, Esposo(a) o compañero(a), Hijo(a), Hijastro(a), Hermano(a), hermanastro(a), Yerno, nuera, Nieto(a), Otro no pariente, Otro pariente del jefe(a)]
Categories (8, object): [Jefe(a) del hogar, Esposo(a) o compañero(a), Hijo(a), Hijastro(a),
                         Hermano(a), hermanastro(a), Yerno, nuera, Nieto(a), Otro no pariente,
                         Otro pariente del jefe(a)]
P1174 
 [Sí, No]
Categories (2, object): [Sí, No]
P1173 
 [Ninguno de los anteriores, Negro, mulato (afrodescendiente), Indígena, Raizal del archipiélago, Gitano (rom), Palenquero]
Categories (6, object): [Ninguno de los anteriores, Negro, mulato (afrodescendiente), Indígena,
                         Raizal del archipiélago, Gitano (rom), Palenquero]
P426 
 [No esta casado(a) y vive en pareja hace dos añ..., No está casado(a) y vive en pareja hace menos ..., Esta casado(a), Está separado(a) o divorciado(a), Está soltero(a), Está viudo(a)]
Categories (6, object): [No esta casado(a) y vive en pareja hace dos añ..., No está casado(a) y vive en pareja hace menos ...,
                         Esta casado(a), Está separado(a) o divorciado(a), Está soltero(a),
                         Está viudo(a)]
P1172 
 [Sí, No]
Categories (2, object): [Sí, No]
P1172S1 
 [ 2.  1.  3.  4.  5.  6.  7. 11.  8.  9. 16. 10. 12. 13. 15. 19. 22.]
P5762 
 [No, Fallecida, Sí]
Categories (3, object): [No, Fallecida, Sí]
P5762S2 
 [ 5.  2.  6.  1.  8.  3.  4.  7. 10. 11.  9.]
P5754 
 [No, Fallecido, Sí]
Categories (3, object): [No, Fallecido, Sí]
P5754S2 
 [ 1. 11.  2.  5.  4.  8.  3.  7.  6. 10.  9. 12. 13.]

De acuerdo al diccionario todos los valores son válidos

Unión de los dataframes

In [376]:
final = pd.merge(compHogar,fuerTrabajo, how='inner',on='DIRECTORIO')
final = pd.merge(condiVida, final, how='inner',on='DIRECTORIO')
final.head()
Out[376]:
DIRECTORIO REGION clase P424 P4030S1 P4030S1A1 P4030S5 P4030S3 P4030S4 P4030S4A1 P4030S2 P4020 SECUENCIA_P_x ORDEN_x P6040 P6020 P425 P1174 P1173 P426 P1172 P1172S1 P5762 P5762S2 P5754 P5754S2 SECUENCIA_P_y ORDEN_y P6370S1 P6390S1 P6880 P6440 P6400 P1151 P1150 P1150S1 P1150S2 P1099S1 P1099S2 P427 P6500 P6750 P6760 P6426 P428 P6250 P6510 P6545 P1145 P1149S1 P1148S1
0 2915595.0 Central Cabecera Apartamento 1 3 Baldosa, cerámica, laminado 1 1.0 25 Hombre Jefe(a) del hogar Ninguno de los anteriores No esta casado(a) y vive en pareja hace dos añ... 2.0 No 2.0 No 1.0 1 1.0 45.0 5243.0 De puerta en puerta 45.0 5243.0 0.0 5243.0 0.0 Obrero o empleado de empresa particular 5243.0 662456.974148 1.0 6.0 10 a 50 personas No No No. No. 5243.0 5243.0
1 2915595.0 Central Cabecera Apartamento 1 3 Baldosa, cerámica, laminado 1 1.0 25 Hombre Jefe(a) del hogar Ninguno de los anteriores No esta casado(a) y vive en pareja hace dos añ... 2.0 No 2.0 No 1.0 1 2.0 45.0 5135.0 Local fijo, oficina, fábrica, etc. No. 48.0 5135.0 0.0 5135.0 30.0 Obrero o empleado de empresa particular 5135.0 662456.974148 1.0 7.0 51 personas o más No No No. No. 5135.0 5135.0
2 2915596.0 Central Cabecera Casa 1 3 Baldosa, cerámica, laminado 1 1.0 52 Hombre Jefe(a) del hogar Ninguno de los anteriores No esta casado(a) y vive en pareja hace dos añ... 2.0 Fallecida 6.0 Fallecido 11.0 1 1.0 37.0 5521.0 En un vehículo 40.0 5521.0 0.0 5521.0 0.0 Obrero o empleado de empresa particular 5521.0 662456.974148 1.0 24.0 10 a 50 personas No No No. No. 5521.0 5521.0
3 2915597.0 Central Cabecera Casa 1 3 Vinilo, tableta, ladrillo, madera pulida sin l... 1 1.0 57 Hombre Jefe(a) del hogar Ninguno de los anteriores No esta casado(a) y vive en pareja hace dos añ... 2.0 No 1.0 Fallecido 1.0 1 1.0 95.0 4521.0 En otras viviendas No. 75.0 4521.0 0.0 4521.0 0.0 Trabajador por cuenta propia 4521.0 600000.000000 1.0 360.0 2 a 4 personas No No No. No. 4521.0 4521.0
4 2915599.0 Central Cabecera Apartamento 1 3 Vinilo, tableta, ladrillo, madera pulida sin l... 1 1.0 51 Hombre Jefe(a) del hogar Ninguno de los anteriores No esta casado(a) y vive en pareja hace dos añ... 2.0 No 5.0 No 2.0 1 1.0 97.0 4530.0 En un vehículo 50.0 4530.0 0.0 4530.0 0.0 Obrero o empleado de empresa particular 4530.0 662456.974148 1.0 12.0 5 a 9 personas No No No. No. 4530.0 4530.0
In [377]:
pandas_profiling.ProfileReport(final)



Out[377]:

Restricciones legales

De acuerdo a lo presente en el sitio web http://microdatos.dane.gov.co/index.php/home no hay restricciones legales con los datos pues se encuentran anonimizados y a disposición del público para su uso. Sin embargo, hay que ser responsable con los resultados que se obtengan y su publicación.

Hipótesis relevantes

  1. La región (REGION) influye en las horas que le toman a las personas el ir al trabajo (P1099S1).
  2. El número de horas trabajadas en el día (P1150S1) puede darnos una idea del material predominante de los pisos del hogar (P4020)
  3. La edad (P6040) está estrechamente relacionada con el estado civil (P426).